function Ankhy_Priest_3()
	ccRS.Auto_Target = false
	ccRS.Auto_Facing = false
	-- Target Player to heal
	local vTargetPlayerToHeal = true
	if ccrTargetName() == "Thok the Bloodthirsty" then vTargetPlayerToHeal = false else vTargetPlayerToHeal = true end
	------------------------
	-- Cascade
	local vTalent = {GetTalentInfo(16)}
	local vGotCascade = false
	if vTalent[6] == true then vGotCascade = true else vGotCascade = false end
	----------------
	-- Divine Star
	local vTalent = {GetTalentInfo(17)}
	local vGotDivineStar = false
	if vTalent[6] == true then vGotDivineStar = true else vGotDivineStar = false end
	----------------
	-- Halo
	local vTalent = {GetTalentInfo(18)}
	local vGotHalo = false
	if vTalent[6] == true then vGotHalo = true else vGotHalo = false end
	----------------------
	-- Mindbender
	local vTalent = {GetTalentInfo(8)}
	local vGotMindbender = false
	if vTalent[6] == true then vGotMindbender = true else vGotMindbender = false end
	----------------------
	-- Cast Power Word: Fortitude
	ccrCastBuffIfMissing("Power Word: Fortitude")
	 ---------------------
	 -- Cast Inner Fire
	ccrCastBuffIfMissing("Inner Fire")
	 ---------------------
	-- Autoaccept LFR invite
	AcceptProposal();
	--------------------------
	-- Shadowform
	ccrCastBuffIfMissing("Shadowform")
	 ---------------------
	 
		 -- Angelic Feather
		if IsMounted() == nil
		and SpellIsReady("Angelic Feather")
		and not ccrPlayerHasBuff("Angelic Feather")
		and ccrPlayerIsMoving()
		then
			ccrCast("Angelic Feather")
			if SpellIsTargeting() == 1 then CastAtLocation(Player:GetLocation()) end
			return
		end
	 
	if IsMounted() == nil and ccrPlayerIsInCombat() then
	
		--CD
			if ccrTargetIsBoss()
				and ccrSpellIsReady("Shadowfiend")
					then
						ccrCastAttack("Shadowfiend")
					return
			end
					--Shadow Word: Death
		if ccrSpellCanAttack("Shadow Word: Death")
				then
					ccrCastAttack("Shadow Word: Death")
				return
		end
			 if ccrTargetCount(40) <= 4
			 and ccR_Priest_CheckForMissingPain() then
			 ccR_Priest_ApplyMissingPain() return end
			 
			 if ccrTargetCount(40) <= 4
			 and ccR_Priest_CheckForMissingTouch() then
			 ccR_Priest_ApplyMissingTouch() return end

		-- Rotation
		--AOE
		if ccrTargetCount(8) > 4
			then
				ccrCastAttack("Mind Sear")
			return
		end
			if ccrTargetHasMyDebuff("Devouring Plague")
			and ccrPlayerHasLeftOnChannel(0.4)
			and not ccrPlayerIsMoving()
				then
					ccrCast("Smite")
				return
		end
		--Mind Blast
		if ccrSpellCanAttack("Mind Blast")
			and not ccrPlayerIsMoving()
				then
				if not ccrPlayerIsCastingSpell("Mind Blast") and not ccrPlayerIsChanneling("Mind Flay(Insanity)") then SpellStopCasting() end
					ccrCastAttack("Mind Blast")
				return
		end
		if (ccrPlayerHasBuff("Toxic Power") and ccrPlayerHasBuff("Expanded Mind"))
			and ccrTargetHasMyDebuff("Shadow Word: Pain")
			and ccrUnitHasMyDebuffDuration("target", "Shadow Word: Pain") < 8
				then
					ccrCastAttack("Shadow Word: Pain")
				return
		end	

		--Shadow Word: Pain
		if not ccrTargetHasMyDebuff("Shadow Word: Pain")
			and not ccrPlayerIsCastingSpell("Mind Flay(Insanity)")
			and ccrSpellCanAttack("Shadow Word: Pain") 
				then
					ccrCastAttack("Shadow Word: Pain")
				return
		else
			if ccrTargetHasMyDebuff("Shadow Word: Pain")
			and ccrUnitHasMyDebuffDuration("target", "Shadow Word: Pain") < 2
			and not ccrPlayerIsCastingSpell("Mind Flay(Insanity)")
				then
					ccrCastAttack("Shadow Word: Pain")
				return
			end	
		end	
		if (ccrPlayerHasBuff("Toxic Power") and ccrPlayerHasBuff("Expanded Mind"))
			and ccrTargetHasMyDebuff("Vampiric Touch")
			and ccrUnitHasMyDebuffDuration("target", "Vampiric Touch") < 8
				then
					ccrCastAttack("Vampiric Touch")
				return
		end	

		--Vampiric Touch
		if not ccrTargetHasMyDebuff("Vampiric Touch")
			and ccrSpellCanAttack("Vampiric Touch")
			and not ccrPlayerIsCastingSpell("Mind Flay(Insanity)")
			and not ccrPlayerIsCastingSpell("Vampiric Touch")
			and not ccrPlayerIsMoving() 
				then
					ccrCastAttack("Vampiric Touch")
				return
		else
			if ccrTargetHasMyDebuff("Vampiric Touch")
			and ccrUnitHasMyDebuffDuration("target", "Vampiric Touch") < 2
			and ccrSpellCanAttack("Vampiric Touch")
			and not ccrPlayerIsCastingSpell("Vampiric Touch")
			and not ccrPlayerIsCastingSpell("Mind Flay(Insanity)")
			and not ccrPlayerIsMoving() 
				then
					ccrCastAttack("Vampiric Touch")
				return
			end	
		end
		if ccrTargetIsBoss()
				and ccrSpellIsReady("Halo")
					then
						ccrCastAttack("Halo")
					return
			end
		--Devouring Plague
		if ccrOrbs()== 3
			and SpellCanAttack("Devouring Plague")
				then
					ccrCastAttack("Devouring Plague")
				return	
		end
		--Mind Flay if Devouring Plague is up on target
		if ccrTargetHasMyDebuff("Devouring Plague")
			and ccrSpellCanAttack("Smite")
			and not ccrPlayerIsChanneling("Mind Flay") or ccrPlayerHasLeftOnChannel(0.4)
			and not ccrPlayerIsMoving()
				then
					ccrCast("Smite")
				return
		end
		if ccrSpellCanAttack("Smite")
			and not ccrPlayerIsChanneling("Mind Flay") or ccrPlayerHasLeftOnChannel(0.4)
			and not ccrPlayerIsMoving()
				then
					ccrCast("Smite")
				return
		end
	end
end